package com.gky.gkytemplate.common.context;

/**
 * 保存线程上下文信息
 * 登录用户的id
 */
public class BaseContext {
    private static ThreadLocal<Long> userThreadLocal = new ThreadLocal<>();

    public static void setUserId(Long userId) {
        userThreadLocal.set(userId);
    }

    public static Long getCurrentId() {
        return userThreadLocal.get();
    }

    public static void removeCurrentId() {
        userThreadLocal.remove();
    }
}
